package com.lanyou.esb.datadictionary;

import java.rmi.NoSuchObjectException;

import org.apache.commons.lang3.StringUtils;

/**
 * BUNDLE操作类型<br>
 * 描述：<br>
 * 0：开始；1：停止；2：刷新；3：更新；4：卸载；
 * 
 * @author Davey.wu
 */
public enum BundleActionType {
	START("0", "start"), STOP("1", "stop"), REFRESH("2", "refresh"), UPDATE(
			"3", "update"), UNINSTALL("4", "uninstall");

	public static final String TypeCode = "20012";

	public final String ValueCode;
	public final String ValueName;

	private BundleActionType(String code, String valueName) {
		this.ValueCode = code;
		this.ValueName = valueName;
	}

	public static BundleActionType get(String valueCode)
			throws NoSuchObjectException {
		if (StringUtils.isEmpty(valueCode)) {
			throw new NullPointerException();
		}
		for (BundleActionType type : BundleActionType.values()) {
			if (type.ValueCode.equals(valueCode)) {
				return type;
			}
		}
		throw new NoSuchObjectException(valueCode);
	}
}
